package com.kevin.springboot.demos.controller;

import com.kevin.springboot.demos.consts.RtConsts;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * controller的基类
 * @author: wangyong
 * @date: 2019/8/17 12:41
 */
public class BaseController {


	@Autowired
	protected HttpServletRequest request;

	@Autowired
	protected HttpServletResponse response;


	void setRt(RtConsts rt){
		response.setHeader(rt.getCode(), rt.getMsg());
	}

	void success(){
		response.setHeader(RtConsts.SUCCESS.getCode(), RtConsts.SUCCESS.getMsg());
	}

	void fail(){
		response.setHeader(RtConsts.SYS_ERROR.getCode(), RtConsts.SYS_ERROR.getMsg());
	}


}
